var cgqgdform = Ext.create('Ext.form.Panel', {
    store: ['Demo.store.purchase.cgqgdStore'],
	bodyPadding: 15,
	layout: 'column',
	baseCls: 'x-plain',
	items:[
			{
				 style: 'margin:0px 0px 0px 45px;',
				 xtype: 'testText1',
				 name: 'salesName',
				 bodyPadding: 5,
				 fieldLabel: '业务人员',
				 width: 250,
				 labelWidth: 80,
			},
			{
				 style: 'margin:0px 0px 0px 45px;',
				 xtype: 'testText1',
				 name: 'maker',
				 bodyPadding: 5,
				 fieldLabel: '制单人员',
				 width: 250,
				 labelWidth: 80,
			},
			{
				 style: 'margin:0px 0px 0px 45px;',
				 xtype: 'testText1',
				 name: '',
				 bodyPadding: 5,
				 fieldLabel: '所属部门',
				 width: 250,
				 labelWidth: 80,
			},
			{
				 style: 'margin:10px 0px 0px 45px;',
				 xtype: 'testText1',
				 name: 'permitter', 
				 bodyPadding: 5,
				 fieldLabel: '复核人员',
				 width: 250,
				 labelWidth: 80,
			}
	      ]
});

var grids = Ext.create('Ext.grid.Panel',{
	store: Ext.create("Ext.data.Store",{
		fields:[{name:'prodId',type:"string"},
		        {name:'sQuantity',type:"int"},
		        {name:'prenInDate',type:"string"},
		        {name:'suggestPurdate',type:"string"},
		        {name:'qtRemain',type:"int"},
		        {name:'itemRemark',type:"string"},
		        {name:'trantype',type:"string"},
		        {name:'fromNo',type:"string"}]
	}),
	height: 160,
	stripeRows:true,   
	autoScroll:false,
	columns: [
				{xtype: 'rownumberer', header: '（栏号）', name: 'lineId', dataIndex: 'lineId', width: 50,sortable: false },
        		{header: '物料编号', dataIndex: 'prodId', width: 100 ,editor:"textfield"},
       			{header: '物料名称', dataIndex: 'sQuantity', width: 120,editor:"textfield" },
       			{header: '规格型号', dataIndex: 'prenInDate' ,editor:"textfield"},
				{header: '单位名称', dataIndex: '' ,editor:"textfield"},
				{header: '数量', dataIndex: 'sQuantity',editor:"textfield"},
				{header: '币别', dataIndex: 'oldPrice',editor:"textfield" },
				{header: '标准进价', dataIndex: 'discount' ,editor:"textfield"},
				{header: '标准进价金额', dataIndex: 'unitPrice' ,editor:"textfield"},
				{header: '币别', dataIndex: 'amount' ,editor:"textfield"},
				{header: '金额', dataIndex: 'taxRate',editor:"textfield" },
				{header: '进价金额', dataIndex: 'tax' ,editor:"textfield"},
				{header: '需求日期', dataIndex: 'prenInDate',editor:"textfield" },
				{header: '建议采购日期', dataIndex: 'suggestPurdate',editor:"textfield" },
				{header: '未请购数量', dataIndex: 'qtRemain',editor:"textfield" },
				{header: '赠品', dataIndex: 'isGift',editor:"textfield" },
				{header: '分录备注', dataIndex: 'itemRemark',editor:"textfield" },
				{header: '来源单别', dataIndex: 'trantype' ,editor:"textfield"},
				{header: '来源单号', dataIndex: 'fromNo' ,editor:"textfield"}
			 ],
	plugins: [  
			   Ext.create('Ext.grid.plugin.CellEditing',{  
				   clicksToEdit:1 //设置单击单元格编辑  
			   })  
			  ],  
	listeners:{
			    //双击行事件  
		itemdblclick:function(dataview, record, item, index, e){
			alert('itemdblclick');
			var data  = {  
			};
			//添加一行表格
			this.getStore().add(data);
		}
	}
		 
});

var cgqgdfilterPanel = Ext.create('Ext.panel.Panel', {
    width: 2000,
    items:[grids],
	bbar:[{xtype:"label",text:'总计:',width:90},
	{xtype:"textfield",disabled:true,width:90,margin:'0 390',value:'0.00'},
	{xtype:"textfield",disabled:true,width:90,margin:'0 400',value:'0.00'}]
});



var  cgqgdtableds = Ext.create('Ext.TabPanel',{
	width: 950,
	height: 230,
	autoScroll:true,
	style: 'margin:10px 0px 0px 60px',
	items: [{title:'内容',autoScroll:true,items:[cgqgdfilterPanel]},{title:'账款'},{title:'备注'}]
});


Ext.define("Demo.view.purchase.cgqgdPanel",{
	extend:"Ext.panel.Panel",
	alias:"widget.cgqgdPanel",
	type:'margin-left:50px',
	width:950,
	type:{
		'border':'1px solid red'
	},
	items:[{
		xtype:"topBar",
		id: "xsckdTop",
		store: Ext.create("Demo.store.purchase.cgqgdStore",{})
	},{
		xtype:"form",
		layout:'column',
		items:[{
			xtype:"testText1",
			name:"bilStyleNo",
			fieldLabel:"采购请购类型"
		},{
			xtype:"testText1",
			name:"billdate",
			fieldLabel:"单据日期"
		},{
			xtype:"testText1",
			name:"billstatus",
			fieldLabel:"单况"
//			stateId:"readOnly"
		},{
			xtype:"testText1",
			name:"billNO",
			fieldLabel:"单据号码"
//			stateId:"readOnly"
		},cgqgdtableds,cgqgdform,{
			xtype:'splitbutton',
			text:'转入',	
			width:90,
			menu:{
				xtype:'menu',
				items:[{
					text:'销售订单转入',handler:function(){
						alert('11111');
					}
				}]
				
			}
			},{
				xtype:'splitbutton',
				text:'功能',	
				width:90,
				menu:{
					xtype:'menu',
					items:[{
						text:'单况状态切换',handler:function(){
							alert('11111');
						}
					}]
					
				}
			}]
}]
});



